using System.Linq;
using System.Text;
using System.Diagnostics;
using System.Runtime.Serialization;
using System.Collections;
using System.Data;
using System.ComponentModel;
using System.Data.OracleClient;
using WPFExcelReport.Helpers;
using WPFExcelReport.Controls;
namespace WPFExcelReport
{
    public partial class VICC_WBERROR
    {
        public void GETFROMWBBST(DataRow dwData)
        {
            or1 = OracleDB.CreateCommand();
            switch (app.company)
            {
                default:
                case "YGR":
                    or1.CommandText = "INSERT INTO ICC_WBERROR(MANDANT, LO, LB, MDATE, WAKZ, ART, VAR, FARBE, FINISH, DESS, COLORIT,RWKRS,RWLFD,RWPOS, STKNR, MQTY, KGQTY, QLV)"
                        + " SELECT DISTINCT WBEWMANDANT,WBEWLO,WBEWLB,WBEWBUCHDAT,WBEWWAKZ,WBEWART,WBEWVAR,WBEWFARBE,WBEWBESCHICH,WBEWDESS,WBEWCOLORIT,WBEWRWKRS,WBEWRWLFD,WBEWPOS,WBEWSTKNR,WBEWMTR,WBEWGEW,WBEWZENSURKZ"
                        + " FROM ICC_WBBEW WHERE WBEWMANDANT=:MANDANT: AND WBEWWAKZ=:WAKZ: AND WBEWBS=13 AND WBEWFC='QI04G   '  AND WBEWWAKZ='R' "
                        + " AND NOT EXISTS(SELECT 1 FROM ICC_WBERROR WHERE WBEWMANDANT=MANDANT AND STKNR=WBEWSTKNR)";
                    or1.CommandText = INTEXDBC.InjectData(or1.CommandText, dwData);
                    break;
            }
            Connect2Proxy(or1);
        }
        public DataSet QWBERROR02(DataRow dwData)
        {
            or1 = OracleDB.CreateCommand();

            or1.CommandText = "SELECT MANDANT, LO, LB, MDATE, WAKZ, ART, VAR, FARBE, FINISH, DESS, COLORIT,SUM(MQTY) AS MQTY, SUM(KGQTY) AS KGQTY,SUM(decode(QLV, 'A', 1,0)) as MQTYA,SUM(decode(QLV, 'B', 1,0)) as MQTYB,SUM(decode(QLV, 'C', 1,0)) as MQTYC,COUNT(*) AS PCS,"
                + "SUM(ER000) AS ER000,SUM(ER001) AS ER001,SUM(ER002) AS ER002,SUM(ER003) AS ER003,SUM(ER004) AS ER004,SUM(ER005)AS ER005,SUM(ER006) AS ER006,SUM(ER007) AS ER007,SUM(ER008) AS ER008,SUM(ER009) AS ER009,"
                + "SUM(ER010) AS ER010,SUM(ER011) AS ER011,SUM(ER012) AS ER012,SUM(ER013) AS ER013,SUM(ER014) AS ER014,SUM(ER015)AS ER015,SUM(ER016) AS ER016,SUM(ER017) AS ER017,SUM(ER018) AS ER018,SUM(ER019) AS ER019,"
                + "SUM(ER020) AS ER020,SUM(ER021) AS ER021,SUM(ER022) AS ER022,SUM(ER023) AS ER023,SUM(ER024) AS ER024,SUM(ER025)AS ER025,SUM(ER026) AS ER026,SUM(ER027) AS ER027,SUM(ER028) AS ER028,SUM(ER029) AS ER029,"
                + "SUM(ER030) AS ER030,SUM(ER031) AS ER031,SUM(ER032) AS ER032,SUM(ER033) AS ER033,SUM(ER034) AS ER034,SUM(ER035)AS ER035,SUM(ER036) AS ER036,SUM(ER037) AS ER037,SUM(ER038) AS ER038,SUM(ER039) AS ER039,"
                + "SUM(ER040) AS ER040,SUM(ER041) AS ER041,SUM(ER042) AS ER042,SUM(ER043) AS ER043,SUM(ER044) AS ER044,SUM(ER045)AS ER045,SUM(ER046) AS ER046,SUM(ER047) AS ER047,SUM(ER048) AS ER048,SUM(ER049) AS ER049,"
                + "SUM(ER050) AS ER050,SUM(ER051) AS ER051,SUM(ER052) AS ER052,SUM(ER053) AS ER053,SUM(ER054) AS ER054,SUM(ER055)AS ER055,SUM(ER056) AS ER056,SUM(ER057) AS ER057,SUM(ER058) AS ER058,SUM(ER059) AS ER059,"
                + "SUM(ER060) AS ER060,SUM(ER061) AS ER061,SUM(ER062) AS ER062,SUM(ER063) AS ER063,SUM(ER064) AS ER064,SUM(ER065)AS ER065,SUM(ER066) AS ER066,SUM(ER067) AS ER067,SUM(ER068) AS ER068,SUM(ER069) AS ER069,"
                + "SUM(ER070) AS ER070,SUM(ER071) AS ER071,SUM(ER072) AS ER072,SUM(ER073) AS ER073,SUM(ER074) AS ER074,SUM(ER075)AS ER075,SUM(ER076) AS ER076,SUM(ER077) AS ER077,SUM(ER078) AS ER078,SUM(ER079) AS ER079,"
                + "SUM(ER080) AS ER080,SUM(ER081) AS ER081,SUM(ER082) AS ER082,SUM(ER083) AS ER083,SUM(ER084) AS ER084,SUM(ER085)AS ER085,SUM(ER086) AS ER086,SUM(ER087) AS ER087,SUM(ER088) AS ER088,SUM(ER089) AS ER089,"
                + "SUM(ER090) AS ER090,SUM(ER091) AS ER091,SUM(ER092) AS ER092,SUM(ER093) AS ER093,SUM(ER094) AS ER094,SUM(ER095)AS ER095,SUM(ER096) AS ER096,SUM(ER097) AS ER097,SUM(ER098) AS ER098,SUM(ER099) AS ER099"
                + "  FROM ICC_WBERROR   WHERE  MANDANT=:MANDANT:  AND WAKZ =:WAKZ:  "
                  + dwData["LO"].ToString()
                + " GROUP BY MANDANT, LO, LB, MDATE, WAKZ, ART, VAR, FARBE, FINISH, DESS, COLORIT"
              ;
            or1.CommandText = INTEXDBC.InjectData(or1.CommandText, dwData);
            SResult = Connect2Proxy(or1);
            SResult.Tables[0].TableName = TableName;
            return SResult;
        }
        public DataSet DWBERROR03(DataRow dwData)
        {
            or1 = OracleDB.CreateCommand();
            or1.CommandText = "SELECT *  FROM ICC_WBERROR   WHERE  MANDANT=:MANDANT:  " + dwData["ART"].ToString();
            or1.CommandText = INTEXDBC.InjectData(or1.CommandText, dwData);
            SResult = Connect2Proxy(or1);
            SResult.Tables[0].TableName = TableName;
            return SResult;
        }

        public void DWBERROR01(DataRow dwData)
        {
            or1 = OracleDB.CreateCommand();

            or1.CommandText = "DELETE FROM ICC_WBERROR   WHERE  MANDANT=:MANDANT: AND MDATE=:MDATE: AND WAKZ =:WAKZ:  ";
            or1.CommandText = INTEXDBC.InjectData(or1.CommandText, dwData);

            Connect2Proxy(or1);
        }

        public void WBERRORS(DataRow dwData)
        {
            or1 = OracleDB.CreateCommand();
            /*
            or1.CommandText = "UPDATE ICC_WBERROR X SET( ER000,ER001,ER002,ER003,ER004,ER005,ER006,ER007,ER008,ER009,ER010,ER011,ER012,ER013,ER014,ER015,ER016,ER017,ER018,ER019,ER020,ER021,ER022,ER023,ER024,ER025,ER026,ER027,ER028,ER029,ER030,ER031,ER032,ER033,ER034,ER035,ER036,ER037,ER038,ER039,ER040,ER041,ER042,ER043,ER044,ER045,ER046,ER047,ER048,ER049,ER050,ER051,ER052,ER053,ER054,ER055,ER056,ER057,ER058,ER059,ER060,ER061,ER062,ER063,ER064,ER065,ER066,ER067,ER068,ER069,ER070,ER071,ER072,ER073,ER074,ER075,ER076,ER077,ER078,ER079,ER080,ER081,ER082,ER083,ER084,ER085,ER086,ER087,ER088,ER089,ER090,ER091,ER092,ER093,ER094,ER095,ER096,ER097,ER098,ER099)"
                + " =(SELECT "
                       + "sum(decode(WBFFSCHL,'000',WBFQPKT,0)) as ER000,sum(decode(WBFFSCHL,'001',WBFQPKT,0)) as ER001,sum(decode(WBFFSCHL,'002',WBFQPKT,0)) as ER002,sum(decode(WBFFSCHL,'003',WBFQPKT,0)) as ER003,sum(decode(WBFFSCHL,'004',WBFQPKT,0)) as ER004,sum(decode(WBFFSCHL,'005',WBFQPKT,0)) as ER005,sum(decode(WBFFSCHL,'006',WBFQPKT,0)) as ER006,sum(decode(WBFFSCHL,'007',WBFQPKT,0)) as ER007,sum(decode(WBFFSCHL,'008',WBFQPKT,0)) as ER008,sum(decode(WBFFSCHL,'009',WBFQPKT,0)) as ER009,"
                       + "sum(decode(WBFFSCHL,'010',WBFQPKT,0)) as ER010,sum(decode(WBFFSCHL,'011',WBFQPKT,0)) as ER011,sum(decode(WBFFSCHL,'012',WBFQPKT,0)) as ER012,sum(decode(WBFFSCHL,'013',WBFQPKT,0)) as ER013,sum(decode(WBFFSCHL,'014',WBFQPKT,0)) as ER014,sum(decode(WBFFSCHL,'015',WBFQPKT,0)) as ER015,sum(decode(WBFFSCHL,'016',WBFQPKT,0)) as ER016,sum(decode(WBFFSCHL,'017',WBFQPKT,0)) as ER017,sum(decode(WBFFSCHL,'018',WBFQPKT,0)) as ER018,sum(decode(WBFFSCHL,'019',WBFQPKT,0)) as ER019,"
                       + "sum(decode(WBFFSCHL,'020',WBFQPKT,0)) as ER020,sum(decode(WBFFSCHL,'021',WBFQPKT,0)) as ER021,sum(decode(WBFFSCHL,'022',WBFQPKT,0)) as ER022,sum(decode(WBFFSCHL,'023',WBFQPKT,0)) as ER023,sum(decode(WBFFSCHL,'024',WBFQPKT,0)) as ER024,sum(decode(WBFFSCHL,'025',WBFQPKT,0)) as ER025,sum(decode(WBFFSCHL,'026',WBFQPKT,0)) as ER026,sum(decode(WBFFSCHL,'027',WBFQPKT,0)) as ER027,sum(decode(WBFFSCHL,'028',WBFQPKT,0)) as ER028,sum(decode(WBFFSCHL,'029',WBFQPKT,0)) as ER029,"
                       + "sum(decode(WBFFSCHL,'030',WBFQPKT,0)) as ER030,sum(decode(WBFFSCHL,'031',WBFQPKT,0)) as ER031,sum(decode(WBFFSCHL,'032',WBFQPKT,0)) as ER032,sum(decode(WBFFSCHL,'033',WBFQPKT,0)) as ER033,sum(decode(WBFFSCHL,'034',WBFQPKT,0)) as ER034,sum(decode(WBFFSCHL,'035',WBFQPKT,0)) as ER035,sum(decode(WBFFSCHL,'036',WBFQPKT,0)) as ER036,sum(decode(WBFFSCHL,'037',WBFQPKT,0)) as ER037,sum(decode(WBFFSCHL,'038',WBFQPKT,0)) as ER038,sum(decode(WBFFSCHL,'039',WBFQPKT,0)) as ER039,"
                       + "sum(decode(WBFFSCHL,'040',WBFQPKT,0)) as ER040,sum(decode(WBFFSCHL,'041',WBFQPKT,0)) as ER041,sum(decode(WBFFSCHL,'042',WBFQPKT,0)) as ER042,sum(decode(WBFFSCHL,'043',WBFQPKT,0)) as ER043,sum(decode(WBFFSCHL,'044',WBFQPKT,0)) as ER044,sum(decode(WBFFSCHL,'045',WBFQPKT,0)) as ER045,sum(decode(WBFFSCHL,'046',WBFQPKT,0)) as ER046,sum(decode(WBFFSCHL,'047',WBFQPKT,0)) as ER047,sum(decode(WBFFSCHL,'048',WBFQPKT,0)) as ER048,sum(decode(WBFFSCHL,'049',WBFQPKT,0)) as ER049,"
                       + "sum(decode(WBFFSCHL,'050',WBFQPKT,0)) as ER050,sum(decode(WBFFSCHL,'051',WBFQPKT,0)) as ER051,sum(decode(WBFFSCHL,'052',WBFQPKT,0)) as ER052,sum(decode(WBFFSCHL,'053',WBFQPKT,0)) as ER053,sum(decode(WBFFSCHL,'054',WBFQPKT,0)) as ER054,sum(decode(WBFFSCHL,'055',WBFQPKT,0)) as ER055,sum(decode(WBFFSCHL,'056',WBFQPKT,0)) as ER056,sum(decode(WBFFSCHL,'057',WBFQPKT,0)) as ER057,sum(decode(WBFFSCHL,'058',WBFQPKT,0)) as ER058,sum(decode(WBFFSCHL,'059',WBFQPKT,0)) as ER059,"
                       + "sum(decode(WBFFSCHL,'060',WBFQPKT,0)) as ER060,sum(decode(WBFFSCHL,'061',WBFQPKT,0)) as ER061,sum(decode(WBFFSCHL,'062',WBFQPKT,0)) as ER062,sum(decode(WBFFSCHL,'063',WBFQPKT,0)) as ER063,sum(decode(WBFFSCHL,'064',WBFQPKT,0)) as ER064,sum(decode(WBFFSCHL,'065',WBFQPKT,0)) as ER065,sum(decode(WBFFSCHL,'066',WBFQPKT,0)) as ER066,sum(decode(WBFFSCHL,'067',WBFQPKT,0)) as ER067,sum(decode(WBFFSCHL,'068',WBFQPKT,0)) as ER068,sum(decode(WBFFSCHL,'069',WBFQPKT,0)) as ER069,"
                       + "sum(decode(WBFFSCHL,'070',WBFQPKT,0)) as ER070,sum(decode(WBFFSCHL,'071',WBFQPKT,0)) as ER071,sum(decode(WBFFSCHL,'072',WBFQPKT,0)) as ER072,sum(decode(WBFFSCHL,'073',WBFQPKT,0)) as ER073,sum(decode(WBFFSCHL,'074',WBFQPKT,0)) as ER074,sum(decode(WBFFSCHL,'075',WBFQPKT,0)) as ER075,sum(decode(WBFFSCHL,'076',WBFQPKT,0)) as ER076,sum(decode(WBFFSCHL,'077',WBFQPKT,0)) as ER077,sum(decode(WBFFSCHL,'078',WBFQPKT,0)) as ER078,sum(decode(WBFFSCHL,'079',WBFQPKT,0)) as ER079,"
                       + "sum(decode(WBFFSCHL,'080',WBFQPKT,0)) as ER080,sum(decode(WBFFSCHL,'081',WBFQPKT,0)) as ER081,sum(decode(WBFFSCHL,'082',WBFQPKT,0)) as ER082,sum(decode(WBFFSCHL,'083',WBFQPKT,0)) as ER083,sum(decode(WBFFSCHL,'084',WBFQPKT,0)) as ER084,sum(decode(WBFFSCHL,'085',WBFQPKT,0)) as ER085,sum(decode(WBFFSCHL,'086',WBFQPKT,0)) as ER086,sum(decode(WBFFSCHL,'087',WBFQPKT,0)) as ER087,sum(decode(WBFFSCHL,'088',WBFQPKT,0)) as ER088,sum(decode(WBFFSCHL,'089',WBFQPKT,0)) as ER089,"
                       + "sum(decode(WBFFSCHL,'090',WBFQPKT,0)) as ER090,sum(decode(WBFFSCHL,'091',WBFQPKT,0)) as ER091,sum(decode(WBFFSCHL,'092',WBFQPKT,0)) as ER092,sum(decode(WBFFSCHL,'093',WBFQPKT,0)) as ER093,sum(decode(WBFFSCHL,'094',WBFQPKT,0)) as ER094,sum(decode(WBFFSCHL,'095',WBFQPKT,0)) as ER095,sum(decode(WBFFSCHL,'096',WBFQPKT,0)) as ER096,sum(decode(WBFFSCHL,'097',WBFQPKT,0)) as ER097,sum(decode(WBFFSCHL,'098',WBFQPKT,0)) as ER098,sum(decode(WBFFSCHL,'099',WBFQPKT,0)) as ER099"
                       + " FROM  WBFEHL ER WHERE ER.WBFRWKRS = X.RWKRS AND ER.WBFRWLFD = X.RWLFD AND ER.WBFRWPOS = X.RWPOS  AND (WBFFSCHL != 'WDC' AND WBFFSCHL != 'PTN')"
                       + " AND X.MDATE=:MDATE: "
                       + " AND EXISTS ( SELECT 1 FROM WBFEHL ER WHERE  ER.WBFRWKRS = X.RWKRS AND ER.WBFRWLFD = X.RWLFD AND ER.WBFRWPOS = X.RWPOS ))";
            */

            or1.CommandText = "UPDATE ICC_WBERROR X SET( ER000,ER001,ER002,ER003,ER004,ER005,ER006,ER007,ER008,ER009,ER010,ER011,ER012,ER013,ER014,ER015,ER016,ER017,ER018,ER019,ER020,ER021,ER022,ER023,ER024,ER025,ER026,ER027,ER028,ER029,ER030,ER031,ER032,ER033,ER034,ER035,ER036,ER037,ER038,ER039,ER040,ER041,ER042,ER043,ER044,ER045,ER046,ER047,ER048,ER049,ER050,ER051,ER052,ER053,ER054,ER055,ER056,ER057,ER058,ER059,ER060,ER061,ER062,ER063,ER064,ER065,ER066,ER067,ER068,ER069,ER070,ER071,ER072,ER073,ER074,ER075,ER076,ER077,ER078,ER079,ER080,ER081,ER082,ER083,ER084,ER085,ER086,ER087,ER088,ER089,ER090,ER091,ER092,ER093,ER094,ER095,ER096,ER097,ER098,ER099)"
           + " =(SELECT "
           + "sum(decode(WBFFSCHL,'000',WBFQPKT,0)) as ER000,sum(decode(WBFFSCHL,'001',WBFQPKT,0)) as ER001,sum(decode(WBFFSCHL,'002',WBFQPKT,0)) as ER002,sum(decode(WBFFSCHL,'003',WBFQPKT,0)) as ER003,sum(decode(WBFFSCHL,'004',WBFQPKT,0)) as ER004,sum(decode(WBFFSCHL,'005',WBFQPKT,0)) as ER005,sum(decode(WBFFSCHL,'006',WBFQPKT,0)) as ER006,sum(decode(WBFFSCHL,'007',WBFQPKT,0)) as ER007,sum(decode(WBFFSCHL,'008',WBFQPKT,0)) as ER008,sum(decode(WBFFSCHL,'009',WBFQPKT,0)) as ER009,"
           + "sum(decode(WBFFSCHL,'010',WBFQPKT,0)) as ER010,sum(decode(WBFFSCHL,'011',WBFQPKT,0)) as ER011,sum(decode(WBFFSCHL,'012',WBFQPKT,0)) as ER012,sum(decode(WBFFSCHL,'013',WBFQPKT,0)) as ER013,sum(decode(WBFFSCHL,'014',WBFQPKT,0)) as ER014,sum(decode(WBFFSCHL,'015',WBFQPKT,0)) as ER015,sum(decode(WBFFSCHL,'016',WBFQPKT,0)) as ER016,sum(decode(WBFFSCHL,'017',WBFQPKT,0)) as ER017,sum(decode(WBFFSCHL,'018',WBFQPKT,0)) as ER018,sum(decode(WBFFSCHL,'019',WBFQPKT,0)) as ER019,"
           + "sum(decode(WBFFSCHL,'020',WBFQPKT,0)) as ER020,sum(decode(WBFFSCHL,'021',WBFQPKT,0)) as ER021,sum(decode(WBFFSCHL,'022',WBFQPKT,0)) as ER022,sum(decode(WBFFSCHL,'023',WBFQPKT,0)) as ER023,sum(decode(WBFFSCHL,'024',WBFQPKT,0)) as ER024,sum(decode(WBFFSCHL,'025',WBFQPKT,0)) as ER025,sum(decode(WBFFSCHL,'026',WBFQPKT,0)) as ER026,sum(decode(WBFFSCHL,'027',WBFQPKT,0)) as ER027,sum(decode(WBFFSCHL,'028',WBFQPKT,0)) as ER028,sum(decode(WBFFSCHL,'029',WBFQPKT,0)) as ER029,"
           + "sum(decode(WBFFSCHL,'030',WBFQPKT,0)) as ER030,sum(decode(WBFFSCHL,'031',WBFQPKT,0)) as ER031,sum(decode(WBFFSCHL,'032',WBFQPKT,0)) as ER032,sum(decode(WBFFSCHL,'033',WBFQPKT,0)) as ER033,sum(decode(WBFFSCHL,'034',WBFQPKT,0)) as ER034,sum(decode(WBFFSCHL,'035',WBFQPKT,0)) as ER035,sum(decode(WBFFSCHL,'036',WBFQPKT,0)) as ER036,sum(decode(WBFFSCHL,'037',WBFQPKT,0)) as ER037,sum(decode(WBFFSCHL,'038',WBFQPKT,0)) as ER038,sum(decode(WBFFSCHL,'039',WBFQPKT,0)) as ER039,"
           + "sum(decode(WBFFSCHL,'040',WBFQPKT,0)) as ER040,sum(decode(WBFFSCHL,'041',WBFQPKT,0)) as ER041,sum(decode(WBFFSCHL,'042',WBFQPKT,0)) as ER042,sum(decode(WBFFSCHL,'043',WBFQPKT,0)) as ER043,sum(decode(WBFFSCHL,'044',WBFQPKT,0)) as ER044,sum(decode(WBFFSCHL,'045',WBFQPKT,0)) as ER045,sum(decode(WBFFSCHL,'046',WBFQPKT,0)) as ER046,sum(decode(WBFFSCHL,'047',WBFQPKT,0)) as ER047,sum(decode(WBFFSCHL,'048',WBFQPKT,0)) as ER048,sum(decode(WBFFSCHL,'049',WBFQPKT,0)) as ER049,"
           + "sum(decode(WBFFSCHL,'050',WBFQPKT,0)) as ER050,sum(decode(WBFFSCHL,'051',WBFQPKT,0)) as ER051,sum(decode(WBFFSCHL,'052',WBFQPKT,0)) as ER052,sum(decode(WBFFSCHL,'053',WBFQPKT,0)) as ER053,sum(decode(WBFFSCHL,'054',WBFQPKT,0)) as ER054,sum(decode(WBFFSCHL,'055',WBFQPKT,0)) as ER055,sum(decode(WBFFSCHL,'056',WBFQPKT,0)) as ER056,sum(decode(WBFFSCHL,'057',WBFQPKT,0)) as ER057,sum(decode(WBFFSCHL,'058',WBFQPKT,0)) as ER058,sum(decode(WBFFSCHL,'059',WBFQPKT,0)) as ER059,"
           + "sum(decode(WBFFSCHL,'060',WBFQPKT,0)) as ER060,sum(decode(WBFFSCHL,'061',WBFQPKT,0)) as ER061,sum(decode(WBFFSCHL,'062',WBFQPKT,0)) as ER062,sum(decode(WBFFSCHL,'063',WBFQPKT,0)) as ER063,sum(decode(WBFFSCHL,'064',WBFQPKT,0)) as ER064,sum(decode(WBFFSCHL,'065',WBFQPKT,0)) as ER065,sum(decode(WBFFSCHL,'066',WBFQPKT,0)) as ER066,sum(decode(WBFFSCHL,'067',WBFQPKT,0)) as ER067,sum(decode(WBFFSCHL,'068',WBFQPKT,0)) as ER068,sum(decode(WBFFSCHL,'069',WBFQPKT,0)) as ER069,"
           + "sum(decode(WBFFSCHL,'070',WBFQPKT,0)) as ER070,sum(decode(WBFFSCHL,'071',WBFQPKT,0)) as ER071,sum(decode(WBFFSCHL,'072',WBFQPKT,0)) as ER072,sum(decode(WBFFSCHL,'073',WBFQPKT,0)) as ER073,sum(decode(WBFFSCHL,'074',WBFQPKT,0)) as ER074,sum(decode(WBFFSCHL,'075',WBFQPKT,0)) as ER075,sum(decode(WBFFSCHL,'076',WBFQPKT,0)) as ER076,sum(decode(WBFFSCHL,'077',WBFQPKT,0)) as ER077,sum(decode(WBFFSCHL,'078',WBFQPKT,0)) as ER078,sum(decode(WBFFSCHL,'079',WBFQPKT,0)) as ER079,"
           + "sum(decode(WBFFSCHL,'080',WBFQPKT,0)) as ER080,sum(decode(WBFFSCHL,'081',WBFQPKT,0)) as ER081,sum(decode(WBFFSCHL,'082',WBFQPKT,0)) as ER082,sum(decode(WBFFSCHL,'083',WBFQPKT,0)) as ER083,sum(decode(WBFFSCHL,'084',WBFQPKT,0)) as ER084,sum(decode(WBFFSCHL,'085',WBFQPKT,0)) as ER085,sum(decode(WBFFSCHL,'086',WBFQPKT,0)) as ER086,sum(decode(WBFFSCHL,'087',WBFQPKT,0)) as ER087,sum(decode(WBFFSCHL,'088',WBFQPKT,0)) as ER088,sum(decode(WBFFSCHL,'089',WBFQPKT,0)) as ER089,"
           + "sum(decode(WBFFSCHL,'090',WBFQPKT,0)) as ER090,sum(decode(WBFFSCHL,'091',WBFQPKT,0)) as ER091,sum(decode(WBFFSCHL,'092',WBFQPKT,0)) as ER092,sum(decode(WBFFSCHL,'093',WBFQPKT,0)) as ER093,sum(decode(WBFFSCHL,'094',WBFQPKT,0)) as ER094,sum(decode(WBFFSCHL,'095',WBFQPKT,0)) as ER095,sum(decode(WBFFSCHL,'096',WBFQPKT,0)) as ER096,sum(decode(WBFFSCHL,'097',WBFQPKT,0)) as ER097,sum(decode(WBFFSCHL,'098',WBFQPKT,0)) as ER098,sum(decode(WBFFSCHL,'099',WBFQPKT,0)) as ER099"
           + " FROM  WBFEHL ER WHERE ER.WBFRWKRS = X.RWKRS AND ER.WBFRWLFD = X.RWLFD AND ER.WBFRWPOS = X.RWPOS  AND (WBFFSCHL != 'WDC' AND WBFFSCHL != 'PTN')"
           + " AND X.MDATE=:MDATE: "
           + " AND EXISTS ( SELECT 1 FROM WBFEHL ER WHERE  ER.WBFRWKRS = X.RWKRS AND ER.WBFRWLFD = X.RWLFD AND ER.WBFRWPOS = X.RWPOS ))";
            or1.CommandText = INTEXDBC.InjectData(or1.CommandText, dwData);
            Connect2Proxy(or1);
        }
    }
}
